#include<iostream>
#include<vector>

using namespace std;

int main(){
	int n, target;
	cin>>n;
	vector<int> nums(n);
	for(int i=0;i<n;i++){
		cin>>nums[i];
	}
	cin>>target;
	
	int l=0, r=n;
	while(l < r) {
        int m = l + (r - l) / 2;
        if (nums[m] == target) {
            cout<<m<<endl; 
			return 0;
        } else if (nums[m] < target) {
            l = m + 1;
        } else if (nums[m] > target) {
            r = m ;
        }
    }
    cout<<r<<endl; 
    return 0;
} 
